package com.matrix.media.config;

import com.matrix.domain.properties.AliProperties;
import com.matrix.media.utils.AliIceUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class IceConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public AliIceUtil aliIceUtil(AliProperties aliOssProperties) throws Exception {
        return new AliIceUtil(aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),
                aliOssProperties.getBucketName(),
                aliOssProperties.getIcePoint());
    }
}
